package com.bjsxt.contant;

/**
 * description:
 * 登录常量
 *
 * @author ALIENWARE <br />
 * @date 2021/6/23
 */
public class LoginConstant {
    /**
     * 后台管理员登录
     */
    public static final String ADMIN_TYPE = "admin_type";
    /**
     * 用户/会员登录
     */
    public static final String MEMBER_TYPE = "member_type";
    /**
     * 管理员 ROLE_CODE 代码
     */
    public static final String ADMIN_ROLE_CODE = "ROLE_ADMIN";
    /**
     *
     */
    public static final String REFRESH_TOKEN = "REFRESH_TOKEN";
    /**
     * 根据用户名称查询用户信息的 sql 语句
     */
    public static final String QUERY_ADMIN_SQL = "SELECT `id`, `username`, `password`, `status` FROM sys_user WHERE username = ? ";
    /**
     * 根据角色 id 查询用户的 code 值的 sql 语句
     */
    public static final String QUERY_ROLE_CODE_SQL = "SELECT `code` FROM sys_role LEFT JOIN sys_user_role ON sys_role.id = sys_user_role.role_id WHERE sys_user_role.user_id= ?";
    /**
     * 查询所有的权限的名称的 sql 语句
     */
    public static final String QUERY_ALL_PERMISSIONS = "SELECT `name` FROM sys_privilege";
    /**
     * 根据用户 id 查询用户对应角色的所有权限名称的 sql 语句
     */
    public static final String QUERY_PERMISSION_SQL = "SELECT `name` FROM sys_privilege LEFT JOIN sys_role_privilege ON sys_role_privilege.privilege_id = sys_privilege.id LEFT JOIN sys_user_role ON sys_role_privilege.role_id = sys_user_role.role_id WHERE sys_user_role.user_id = ?";
    /**
     * 根据用户的手机或者邮箱进行查询会员用户信息的 sql 语句
     */
    public static final String QUERY_MEMBER_SQL = "SELECT `id`,`password`, `status` FROM `user` WHERE mobile = ? or email = ? ";
    /**
     * 使用用户的 id 查询用户名称(系统管理员)
     */
    public static final String QUERY_ADMIN_USER_WITH_ID = "SELECT `username` FROM sys_user where id = ?";
    /**
     * 使用用户的 id 查询用户名称(用户/会员)
     */
    public static final String QUERY_MEMBER_USER_WITH_ID = "SELECT `mobile` FROM user where id = ?";
}
